package gnss

import (
	"encoding/binary"
	"math"
)

func RangeToNaviSys(v byte) byte {
	switch v {
	case 0:
		return SYS_GPS
	case 1:
		return SYS_GLO
	case 2:
		return SYS_SBS
	case 3:
		return SYS_GAL
	case 4:
		return SYS_BD
	case 5:
		return SYS_QZS
	case 7:
		return SYS_WLNAV
	}
	return SYS_UNKOWN
}

func ByteToFloat64(bytes []byte) float64 {
	bits := binary.LittleEndian.Uint64(bytes)
	return math.Float64frombits(bits)
}

func ByteToFloat32(bytes []byte) float32 {
	bits := binary.LittleEndian.Uint32(bytes)
	return math.Float32frombits(bits)
}
